/**
 * 提示：如您想使用JS版本的配置文件可参考：https://github.com/xugaoyi/vuepress-theme-vdoing/tree/a2f03e993dd2f2a3afdc57cf72adfc6f1b6b0c32/docs/.vuepress
 */
import { resolve } from 'path'
import { defineConfig4CustomTheme, UserPlugins } from 'vuepress/config'
import { VdoingThemeConfig } from 'vuepress-theme-vdoing/types'
import { readFileList, readTotalFileWords, readEachFileWords } from './webSiteInfo/readFile' // 站点信息统计
// @ts-ignore
import dayjs from 'dayjs'
import baiduCode from './config/baiduCode' // 百度统计hm码
import htmlModules from './config/htmlModules'
import themeConfig from "./config/themeConfig";
import plugins from "./config/plugins"; // 自定义插入的html块
import {pathPrefix} from "./config/common";

export default defineConfig4CustomTheme<VdoingThemeConfig>({
  theme: 'vdoing', // 使用npm主题包
  // theme: resolve(__dirname, '../../vdoing'), // 使用本地主题包
  port: 20006,
  locales: {
    '/': {
      lang: 'zh-CN',
      title: "Mushroom Notes",
      description: '个人的技术文档',
    }
  },
  base: pathPrefix, // 默认'/'。如果你想将你的网站部署到如 https://foo.github.io/bar/，那么 base 应该被设置成 "/bar/",（否则页面将失去样式等文件）

  // 主题配置
  themeConfig,

  // 注入到页面<head>中的标签，格式[tagName, { attrName: attrValue }, innerHTML?]
  head: [
    ['link', { rel: 'icon', href: '/img/logo/logo.png' }], //favicons，资源放在public文件夹
    ['link', { rel: 'stylesheet', href: 'https://at.alicdn.com/t/font_3077305_pt8umhrn4k9.css' }],
    [
      'meta',
      {
        name: 'keywords',
        content: '个人的技术文档',
      },
    ],
    [
      "meta",
      {
        name:"referrer",
        content:"no-referrer"
      }
    ],
    ['meta', { name: 'baidu-site-verification', content: 'codeva-P56J5w3mAy' }], // 百度统计的站长验证（你可以去掉）
    ['meta', { name: 'theme-color', content: '#11a8cd' }], // 移动浏览器主题颜色
    ['meta', { name: 'referrer', content: 'no-referrer-when-downgrade' }],
  ],

  // 插件配置
  plugins,

  markdown: {
    lineNumbers: true,
    extractHeaders: ['h2', 'h3', 'h4', 'h5', 'h6'], // 提取标题到侧边栏的级别，默认['h2', 'h3']
  },

  // 监听文件变化并重新构建
  extraWatchFiles: [
    '.vuepress/config/*',
    '.vuepress/config.ts',
    '.vuepress/config/htmlModules.ts',
  ]
})